package com.hsgene.generator.constants;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

/**
 * Generator相关系统配置参数
 *
 * @author wangbing
 * @version 1.0, 2018/6/29
 */
@Component
public class GeneratorConstants {

    /**
     * 默认短信验证码长度
     */
    private final static Integer DEFAULT_SMS_VERIFY_CODE_LENGTH = 4;

    /**
     * 短息验证码长度
     */
    @Value("${sms.verify.code.length}")
    private Integer smsVerifyCodeLength;

    public Integer getSmsVerifyCodeLength() {
        if (smsVerifyCodeLength == null || smsVerifyCodeLength < 1) {
            return DEFAULT_SMS_VERIFY_CODE_LENGTH;
        }
        return smsVerifyCodeLength;
    }
}
